package com.cryptoneedle.center.ods.repository.ods;

import com.bubbles.engine.data.core.repository.BaseRepository;
import com.cryptoneedle.center.common.key.ColumnMappingKey;
import com.cryptoneedle.center.ods.entity.ods.OdsMappingColumn;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * <p>description: DWD-Column </p>
 *
 * @author CryptoNeedle
 * @date 2025-09-25
 */
@Repository
public interface OdsMappingColumnRepository extends BaseRepository<OdsMappingColumn, ColumnMappingKey> {

    @Modifying
    @Query("""
        DELETE FROM OdsMappingColumn
         WHERE catalogName = :catalogName
           AND databaseName = :databaseName
           AND tableName = :tableName
           AND mappingCatalogName = :mappingCatalogName
           AND mappingDatabaseName = :mappingDatabaseName
           AND mappingTableName = :mappingTableName""")
    void deleteByOdsMappingTable(String catalogName, String databaseName, String tableName, String mappingCatalogName, String mappingDatabaseName, String mappingTableName);
}